<?php 
namespace app\supermanager\controller;
use app\common\traits\controller\TraitController;
use \app\common\traits\controller\TraitUpload;
/**
 * 百度编辑器图片
 */
class UploadImg extends \think\Controller
{
	use TraitController;
	use TraitUpload;
	
	/**
	 * 初始化操作
	 */
	protected function init()
    {
        if (!model('Managers')->checkLogin()) {
            $this->redirect('@manager/login');
            exit;
        }
    }
	/**
	 * 上传图片
	 */
	public function postIndex()
    {
    	if ($this->upload('file')) {
    		$url = $this->getUploadInfos();
    		return json(array(
                "state" => 'SUCCESS',
                "url" => $url['url'],
            ));
    	}
    }
	/**
	 * 百度编辑器上传图片
	 */
	public function getIndex()
    {
    	if ($this->upload('upfile')) {
    		$url = $this->getUploadInfos();
    		return json(array(
                "state" => 'SUCCESS',
                "url" => $url['url'],
            ));
    	}
    }
}









 ?>